<?php

class import_ref extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'import_ref':
	 * @var integer $id
	 * @var integer $do_id
	 * @var string $ref_no
	 * @var integer $ref_type
	 * @var integer $import_id
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'import_ref';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ref_type, import_id, id', 'numerical', 'integerOnly'=>true),
			array('ref_no', 'length', 'max'=>50),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
                    'import'=>array(self::BELONGS_TO,'import','import_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'Id',
			'do_id' => 'Do',
			'ref_no' => 'Ref No',
			'ref_type' => 'Ref Type',
			'import_id' => 'Import',
		);
	}
}